<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         // 成绩统计:作业练习
         let num = prompt('请输入班级总人数');
         let sum = 0; 
         let average= 0;
         for(let i = 1;i<=num;i++){
            let score = prompt('请输入第'+i+'个学生的成绩');
            sum = sum + parseFloat(score);
         }
         num=parseInt(num);
         average =sum / num; 
         alert('班级总成绩为'+sum);
         alert('班级平均分为'+average);
         console.log(typeof sum);
    </script>
</body>
</html>